<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>promise封装ajax</title>
</head>
<body>
<script>
    const p = new Promise((resolve,reject) => {
        setTimeout(() => {
            reject('出错啦');
        },1000)
    });

    p.catch(function (value){
        console.log(value)
    },function (reason){
        console.error(reason)
    })
</script>

</body>
</html>